/* AsciiDoctor Dark Theme
 * A dark theme for AsciiDoctor HTML output
 */

/* Import modern fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;600&display=swap');

/* Import the default AsciiDoctor stylesheet first */
@import "https://cdn.jsdelivr.net/gh/asciidoctor/asciidoctor@2.0/data/stylesheets/asciidoctor-default.css";

/* Base color variables */
:root {
    --bg-color: #1e1e1e;
    --text-color: #e0e0e0;
    --link-color: #4da6ff;
    --link-hover-color: #80bfff;
    --heading-color: #63c0f5;
    --code-bg-color: #2d2d2d;
    --code-text-color: #f8f8f2;
    --quote-bg-color: #2a2a2a;
    --quote-border-color: #444444;
    --table-header-bg: #2d2d2d;
    --table-border-color: #444444;
    --table-alt-bg: #292929;
    --admonition-note-bg: #264f78;
    --admonition-tip-bg: #2d632d;
    --admonition-important-bg: #663c00;
    --admonition-warning-bg: #7a3300;
    --admonition-caution-bg: #7a0000;
}

/* Basic elements */
html, body {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: -0.01em;
}

/* Links */
a, a:hover, a:focus {
    color: var(--link-color) !important;
}

a:hover, a:focus {
    color: var(--link-hover-color) !important;
    text-decoration: underline;
}

/* Document title and top-most header - make it white */
h1, #header h1, #header > h1:first-child, #toctitle, .sidebarblock > .content > .title {
    color: #ffffff !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Other headings keep the blue tint */
h2, h3, h4, h5, h6 {
    color: var(--heading-color) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 600;
    letter-spacing: -0.015em;
}

/* Code blocks - more specific targeting */
pre {
    background-color: var(--code-bg-color) !important;
    color: var(--code-text-color) !important;
    border: 1px solid #444 !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace !important;
    font-weight: 400;
    font-size: 0.9em;
    line-height: 1.5;
    border-radius: 6px;
}

code {
    background-color: var(--code-bg-color) !important;
    color: var(--code-text-color) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace !important;
    font-weight: 400;
    font-size: 0.9em;
}

/* Listing blocks (most common code blocks in AsciiDoc) */
.listingblock pre,
.listingblock pre[class],
.listingblock .content pre,
.literalblock pre,
.literalblock pre[class],
.literalblock .content pre {
    background-color: var(--code-bg-color) !important;
    color: var(--code-text-color) !important;
    border: 1px solid #444 !important;
    padding: 1.2em !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace !important;
    font-weight: 400;
    line-height: 1.5;
    border-radius: 6px;
}

/* Source blocks */
.sourceblock pre,
.sourceblock .content pre {
    background-color: var(--code-bg-color) !important;
    color: var(--code-text-color) !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace !important;
}

/* Override any syntax highlighting that might interfere */
.listingblock .content,
.literalblock .content,
.sourceblock .content {
    background-color: var(--code-bg-color) !important;
}

/* Tables */
table {
    background-color: transparent !important;
    border-color: var(--table-border-color) !important;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

table thead, table tfoot {
    background-color: var(--table-header-bg) !important;
    font-weight: 600;
}

table tr.even, table tr.alt, table tr:nth-of-type(even) {
    background-color: var(--table-alt-bg) !important;
}

table td, table th {
    border-color: var(--table-border-color) !important;
}

/* Blockquotes */
blockquote, .quoteblock {
    background-color: var(--quote-bg-color) !important;
    border-left: 4px solid var(--quote-border-color) !important;
    font-style: italic;
    position: relative;
    padding: 1.5em !important;
    border-radius: 0 6px 6px 0;
}

blockquote::before {
    content: '"';
    font-size: 4em;
    color: var(--quote-border-color);
    position: absolute;
    top: -0.5em;
    left: 0.2em;
    font-family: Georgia, serif;
    opacity: 0.3;
}

/* Sidebars and panels */
.sidebarblock {
    background-color: #252525 !important;
    border: 1px solid #444 !important;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.exampleblock > .content {
    background-color: #252525 !important;
    border: 1px solid #444 !important;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Admonition blocks */
.admonitionblock > table td.icon {
    text-align: center;
    width: 80px;
}

.admonitionblock > table td.icon img {
    max-width: none;
}

.admonitionblock > table td.icon .title {
    font-weight: bold;
    text-transform: uppercase;
}

.admonitionblock > table td.content {
    padding-left: 1.125em;
    padding-right: 1.25em;
    border-left: 1px solid #444;
    color: #e0e0e0 !important;
}

.admonitionblock.note > table td.icon {
    background-color: var(--admonition-note-bg) !important;
}

.admonitionblock.tip > table td.icon {
    background-color: var(--admonition-tip-bg) !important;
}

.admonitionblock.important > table td.icon {
    background-color: var(--admonition-important-bg) !important;
}

.admonitionblock.warning > table td.icon {
    background-color: var(--admonition-warning-bg) !important;
}

.admonitionblock.caution > table td.icon {
    background-color: var(--admonition-caution-bg) !important;
}

/* TOC - standard and left panel */
#toc, #toc.toc, #content #toc, #toc.toc2, #header .details, .sidebarblock, .listingblock, .literalblock, .imageblock, .tableblock {
    background-color: #252525 !important;
    border: 1px solid #444 !important;
    border-radius: 8px;
}

#toc a, #toc.toc a, #content #toc a, #toc.toc2 a {
    color: var(--link-color) !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

#toc a:hover, #toc.toc a:hover, #content #toc a:hover, #toc.toc2 a:hover {
    color: var(--link-hover-color) !important;
}

/* Left sidebar TOC */
.toc2 {
    background-color: #1a1a1a !important;
    border-right: 1px solid #444 !important;
    color: var(--text-color) !important;
    backdrop-filter: blur(10px);
}

body.toc2 {
    background-color: var(--bg-color) !important;
}

#toc.toc2 #toctitle {
    color: var(--heading-color) !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 600;
}

/* TOC list items */
#toc.toc2 ul.sectlevel0 > li > a, #toc.toc2 ul.sectlevel1 > li > a {
    color: var(--link-color) !important;
}

#toc.toc2 ul.sectlevel0 > li > a:hover, #toc.toc2 ul.sectlevel1 > li > a:hover {
    color: var(--link-hover-color) !important;
}

/* Current selection in TOC */
#toc.toc2 ul.sectlevel0 > li.active > a, #toc.toc2 ul.sectlevel1 > li.active > a {
    font-weight: bold;
    color: var(--heading-color) !important;
}

/* Footer */
#footer, #footer-text {
    color: #888 !important;
}

/* Horizontal rule */
hr {
    border-top: 1px solid #444 !important;
}

/* Mark the floating header anchors */
.anchor {
    color: var(--heading-color) !important;
}

/* Footnotes */
.footnote, .footnotes ol li {
    color: #bbb !important;
}

/* Keyboard/button shortcuts */
.keyseq {
    color: #ddd !important;
}

kbd {
    background-color: #333 !important;
    border: 1px solid #555 !important;
    color: #ddd !important;
}

/* Source code highlighting - basic overrides */
.hljs {
    background-color: var(--code-bg-color) !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace !important;
}

/* Override any specific syntax highlighting themes */
.hljs, .hljs-subst {
    color: var(--code-text-color) !important;
}

/* Java-specific syntax highlighting fixes */
.hljs-annotation,
.hljs-meta {
    color: #ffb86c !important; /* Orange for annotations like @Override */
}

.hljs-keyword {
    color: #ff79c6 !important; /* Pink for keywords */
}

.hljs-string {
    color: #f1fa8c !important; /* Yellow for strings */
}

.hljs-comment {
    color: #6272a4 !important; /* Blue-gray for comments */
    font-style: italic;
}

.hljs-number {
    color: #bd93f9 !important; /* Purple for numbers */
}

.hljs-class .hljs-title,
.hljs-type {
    color: #8be9fd !important; /* Cyan for class names and types */
}

.hljs-function .hljs-title {
    color: #50fa7b !important; /* Green for function names */
}

.hljs-variable,
.hljs-name {
    color: #f8f8f2 !important; /* Light gray for variables */
}

.hljs-attr {
    color: #50fa7b !important; /* Green for attributes */
}

.hljs-symbol,
.hljs-bullet {
    color: #8be9fd !important; /* Cyan for symbols */
}

.hljs-built_in,
.hljs-builtin-name {
    color: #8be9fd !important; /* Cyan for built-ins */
}

.hljs-literal {
    color: #bd93f9 !important; /* Purple for literals */
}

.hljs-params {
    color: #ffb86c !important; /* Orange for parameters */
}

/* Generic syntax highlighting for non-hljs code */
.token.annotation,
.token.meta {
    color: #ffb86c !important;
}

.token.keyword {
    color: #ff79c6 !important;
}

.token.string {
    color: #f1fa8c !important;
}

.token.comment {
    color: #6272a4 !important;
    font-style: italic;
}

.token.number {
    color: #bd93f9 !important;
}

.token.class-name {
    color: #8be9fd !important;
}

.token.function {
    color: #50fa7b !important;
}

/* Callouts */
.conum[data-value] {
    background-color: rgba(80, 160, 250, 0.8) !important;
    color: #fff !important;
}

.conum[data-value] * {
    color: #fff !important;
}

/* Image borders */
.imageblock img, .image img {
    border: 1px solid #444 !important;
}

/* Print styles - ensure dark theme also works in print */
@media print {
    body {
        background-color: var(--bg-color) !important;
        color: var(--text-color) !important;
    }

    a, a:visited {
        color: var(--link-color) !important;
    }
}